<!DOCTYPE html>
<html>
<head>
    <title>备件目录</title>
    #parse("sys/header.html")
    <style>
        .ui-jqgrid {
            width: 100%;
            float: right;
        }
        .leftHeight {
            height: 85vh;
            overflow: auto;
        }
        ::-webkit-scrollbar{
            width: 10px;
            height: 10px;
        }
        ::-webkit-scrollbar-thumb{
            border-radius: 10px;
            -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
            background: #a8a5a5;
        }
        .workShops {
            position: absolute;
            top: 0;
            width: 100%;
            height: 25px;
            background-color: white;
        }

    </style>
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="currentCard=='list'">
        <Row :gutter="16"  style="margin: 8px 0px 0px 1px">
            <div class="search-group">
                <i-col span="3">
                    <i-input type="text"  icon="md-arrow-dropdown-circle"
                             readonly="readonly"
                             v-model="warehouseShow"
                             @on-click="deptTree" placeholder="请选择仓库名称"></i-input>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.partName" @on-enter="query" placeholder="备件名称"></i-input>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.spec" @on-enter="query" placeholder="备件规格"></i-input>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.partCode" @on-enter="query" placeholder="备件编码"></i-input>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.erpCode" @on-enter="query" placeholder="ERP编码"></i-input>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.producor" @on-enter="query" placeholder="供应厂商"></i-input>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
        </Row>
        <Row :gutter="16" style="margin: 3px 0px 0px 0px;">
            <div class="buttons-group">
                #if($shiro.hasPermission("sparestorepos:import"))
                <Upload ref="uploadFile"
                        action="../sparestorepos/import"
                        :format="['xlsx','xls']"
                        :before-upload="handleBeforeUploadExcel"
                        :on-success="handleImportExcelSuccess" :on-error="handleImportExcelError"
                        :on-format-error="handleExcelFormatError" class="sugon_upload_btn">
                    <i-button type="error"><i class="fa fa-hand-o-down"></i>&nbsp;导入</i-button>
                </Upload>
                #end
                <i-button type="info" @click="stockOut"><i class="fa fa-mail-forward"></i>&nbsp;备件出库</i-button>
                #if($shiro.hasPermission("sparestorepos:exchange"))
                <i-button type="info" @click="exchangeStorePos"><i class="fa fa-exchange"></i>&nbsp;备件移库</i-button>
                #end
                #if($shiro.hasPermission("sparestorepos:save"))
                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                #end
                #if($shiro.hasPermission("sparestorepos:update"))
                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
                #end
                #if($shiro.hasPermission("sparestorepos:delete"))
                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
            </div>
        </Row>
<!--        <Row :gutter="16" style="margin: 8px 0px 0px 1px;">-->
<!--            <i-col  >-->
<!--                <div class="leftHeight">-->
<!--                    <div class="workShops">-->
<!--                        <p class="text-center" style="font-size: 15px;">仓库</p>-->
<!--                    </div>-->
<!--                    <div id="storeLayer" style="margin-top: 25px">-->
<!--                        <ul id="storeTree" class="ztree"></ul>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </i-col>-->
<!--            <i-col :xs="21" :sm="21" :md="21" :lg="21">-->
<!--                <table id="jqGrid"></table>-->
<!--            </i-col>-->
<!--        </Row>-->
        <Row  :gutter="16" style="margin: 8px 0px 0px 1px;">
<!--           <i-col :xs="3" :sm="3" :md="3" :lg="3">-->
<!--               <div class="leftHeight">-->
<!--                   <div class="workShops">-->
<!--                       <p class="text-center" style="font-size: 15px;">仓库</p>-->
<!--                   </div>-->
<!--                   <div id="storeLayer" style="margin-top: 25px">-->
<!--                       <ul id="storeTree" class="ztree"></ul>-->
<!--                   </div>-->
<!--               </div>-->
<!--           </i-col>-->
            <i-col :xs="24" :sm="24" :md="24" :lg="24">
                  <table id="jqGrid"></table>
            </i-col>
        </Row>
    </div>
    <!-- 移库CARD -->
    <Card v-show="currentCard=='exchange'">
        <i-form ref="formValidate" :model="spareStorePos" :rules="ruleValidate" :label-width="80">
            <Card :bordered="false" :dis-hover="true" :padding="10">
                <p slot="title">当前库位</p>
                <Row>
                    <i-col span="11">
                        <Form-item label="库房名称" prop="storeName">
                            <i-input v-model="spareStorePos.storeName" placeholder="库房名称" readonly/>
                        </Form-item>
                    </i-col>
                    <i-col span="11">
                        <Form-item label="库位" prop="postion">
                            <i-input v-model="spareStorePos.postion" placeholder="备件编码" readonly/>
                        </Form-item>
                    </i-col>
                </Row>
                <Row>
                    <i-col span="11">
                        <Form-item label="备件名称" prop="spareName">
                            <i-input v-model="spareStorePos.spareName" placeholder="备件名称" readonly/>
                        </Form-item>
                    </i-col>
                    <i-col span="11">
                        <Form-item label="备件编码" prop="spareCode">
                            <i-input v-model="spareStorePos.spareCode" placeholder="库存数" readonly/>
                        </Form-item>
                    </i-col>
                </Row>
                <Row>
                    <i-col span="11">
                        <Form-item label="库存数" prop="storeNum">
                            <input-number v-model="spareStorePos.storeNum" placeholder="库存数" readonly style="width: 100%"></input-number>
                        </Form-item>
                    </i-col>
                    <i-col span="11">
                        <Form-item label="转移库存数" prop="exchangeNum">
                            <input-number v-model="spareStorePos.exchangeNum" placeholder="库存数" :min="1" :max="spareStorePos.storeNum" style="width: 100%"></input-number>
                        </Form-item>
                    </i-col>
                </Row>
                <i-hidden v-model="spareStorePos.id"/>
            </Card>
            <Card :bordered="false" :dis-hover="true" :padding="10">
                <p slot="title">目标库位</p>
                <Row>
                    <i-col span="11">
                        <Form-item label="入库仓库" prop="intStore">
                            <i-input v-model="spareStorePos.targetStoreId" v-show="false"></i-input>
                            <i-input v-model="spareStorePos.targetStoreName" placeholder="入库仓库" readonly icon="md-arrow-dropdown-circle" @on-click="getStoreHouse"></i-input>
                        </Form-item>
                    </i-col>
                    <i-col span="11" v-if="!showOther" offset="2">
                        <Form-item label="货位">
                            <i-select v-model="spareStorePos.targetId" style="width: 80%" >
                                <i-option v-for="storePos in storePosList" :value="storePos.id" :key="storePos.id">{{storePos.postion}} 库存：{{storePos.storeNum}}
                                </i-option>
                            </i-select>
                            <i-button type="info" @click="showLoc(0)" style="width: 15%">&nbsp;其它</i-button>
                        </Form-item>
                    </i-col>
                    <i-col span="11" v-else offset="2">
                        <Form-item label="新货位">
                            <i-input v-model="spareStorePos.targetPostion"  style="width: 80%"></i-input>
                            <i-button type="info" @click="showLoc(1)" style="width: 15%">&nbsp;选择</i-button>
                        </Form-item>
                    </i-col>
                </Row>
            </Card>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px"/> 返回</i-button>
            </Form-item>
        </i-form>
    </Card>

    <!-- 备件出库CARD -->
    <Card v-show="currentCard=='stockOut'">
        <i-form ref="formValidate" :model="consumeRecord" :rules="ruleValidate" :label-width="80">
            <Card :bordered="false" :dis-hover="true" :padding="10">
                <p slot="title">出库</p>
                <Row>
                    <i-col span="11">
                        <Form-item label="库房名称" prop="storeName">
                            <i-input v-model="consumeRecord.storeName" placeholder="库房名称" readonly/>
                        </Form-item>
                    </i-col>
                    <i-col span="11">
                        <Form-item label="库位" prop="postion">
                            <i-input v-model="consumeRecord.postion" placeholder="备件编码" readonly/>
                        </Form-item>
                    </i-col>
                </Row>
                <Row>
                    <i-col span="11">
                        <Form-item label="备件名称" prop="spareName">
                            <i-input v-model="consumeRecord.spareName" placeholder="备件名称" readonly/>
                        </Form-item>
                    </i-col>
                    <i-col span="11">
                        <Form-item label="备件编码" prop="spareCode">
                            <i-input v-model="consumeRecord.spareCode" placeholder="库存数" readonly/>
                        </Form-item>
                    </i-col>
                </Row>
                <Row>
                    <i-col span="11">
                        <Form-item label="库存数" prop="storeNum">
                            <i-input v-model="consumeRecord.storeNum" placeholder="库存数" readonly/>
                        </Form-item>
                    </i-col>
                    <i-col span="11">
                        <Form-item label="出库数" prop="stockOutNum">
                            <input-number v-model="consumeRecord.num" :min="1" :max="consumeRecord.stockOutMaxNum" style="width: 100%"></input-number>
                        </Form-item>
                    </i-col>
                </Row>
                <Row>
                    <i-col span="11">
                        <Form-item label="关联维修">
                            <i-switch v-model="consumeRecord.repairRelated" @on-change="relateRepair">
                                <span slot="open">是</span>
                                <span slot="close">否</span>
                            </i-switch>
                        </Form-item>
                    </i-col>
                    <i-col span="11" v-show="consumeRecord.isRepairRelated">
                        <Form-item label="维修记录">
                            <i-input v-model="consumeRecord.businessId" placeholder="请选择维修记录" icon="md-arrow-dropdown-circle" @on-click="showRepairRecord" icon="md-arrow-dropdown-circle"  readonly/>
                        </Form-item>
                    </i-col>
                </Row>
            </Card>
            <Form-item>
                <i-button type="primary" @click="submitConsumeRecord">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px"/> 返回</i-button>
            </Form-item>
        </i-form>
    </Card>
    <!--车间选择框-->
    <div id="storeLayer" class="treeContent" style="display: none;padding:10px;">
        <ul id="storeTree" class="ztree"></ul>
    </div>
</div>
<script src="${rc.contextPath}/js/spare/sparestorepos.js?_${date.systemTime}"></script>
</body>
</html>
